#include <stdio.h>
#include <stdlib.h>
#include <flgrCoreData.h>
#include <flgrCoreDataIO.h>
#include <flgrCoreCopy.h>
#include <flgrCoreReplace.h>
#include <flgrCoreVector.h>
#include "../macro.h"










/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_I_I_I(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype rawtst[]     = {  0,  5,  7,  1,  0,  0,  3,  0,  7,  9};	\
									\
  dtype rawtrue[]    = {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1};	\
  dtype rawfalse[]   = {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0};	\
									\
  dtype rawref[]     = {  1,  1,  0,  0,  0,  1,  0,  0,  1,  0};	\
  dtype rawrefdif[]  = {  0,  0,  1,  1,  1,  0,  1,  1,  0,  1};	\
  dtype rawrefleq[]  = {  1,  1,  1,  1,  0,  1,  1,  0,  1,  1};	\
  dtype rawrefgreq[] = {  1,  1,  0,  0,  1,  1,  0,  1,  1,  0};	\
  dtype rawrefgr[]   = {  0,  0,  0,  0,  1,  0,  0,  1,  0,  0};	\
  dtype rawrefl[]    = {  0,  0,  1,  1,  0,  0,  1,  0,  0,  1};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattst, *dattrue, *datfalse;				\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattst     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattrue    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datfalse   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattst,rawtst);					\
  flgr1d_import_raw_ptr(dattrue,rawtrue);				\
  flgr1d_import_raw_ptr(datfalse,rawfalse);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_I_I_I(datdest,datsrc,"==",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_I_I_I(datdest,datsrc,"!=",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_I_I(datdest,datsrc,"<=",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_I_I_I(datdest,datsrc,"<",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_I_I(datdest,datsrc,">=",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_I_I_I(datdest,datsrc,">",dattst,		\
				  dattrue,datfalse);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattst);						\
  flgr1d_destroy(dattrue);						\
  flgr1d_destroy(datfalse);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
									\
  return 6


int testreplace1d_I_with_I_I_I_fgUINT8(void) {
  tstReplace1d_I_with_I_I_I(fgUINT8);
}

int testreplace1d_I_with_I_I_I_fgUINT16(void) {
  tstReplace1d_I_with_I_I_I(fgUINT16);
}

int testreplace1d_I_with_I_I_I_fgUINT32(void) {
  tstReplace1d_I_with_I_I_I(fgUINT32);
}

int testreplace1d_I_with_I_I_I_fgINT8(void) {
  tstReplace1d_I_with_I_I_I(fgINT8);
}

int testreplace1d_I_with_I_I_I_fgINT16(void) {
  tstReplace1d_I_with_I_I_I(fgINT16);
}

int testreplace1d_I_with_I_I_I_fgINT32(void) {
  tstReplace1d_I_with_I_I_I(fgINT32);
}

int testreplace1d_I_with_I_I_I_fgFLOAT32(void) {
  tstReplace1d_I_with_I_I_I(fgFLOAT32);
}

int testreplace1d_I_with_I_I_I_fgFLOAT64(void) {
  tstReplace1d_I_with_I_I_I(fgFLOAT64);
}










/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_C types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_I_I_C(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype rawtst[]     = {  0,  5,  7,  1,  0,  0,  3,  0,  7,  9};	\
									\
  dtype rawtrue[]    = {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1};	\
  dtype vfalse       = 5;						\
									\
  dtype rawref[]     = {  1,  1,  5,  5,  5,  1,  5,  5,  1,  5};	\
  dtype rawrefdif[]  = {  5,  5,  1,  1,  1,  5,  1,  1,  5,  1};	\
  dtype rawrefleq[]  = {  1,  1,  1,  1,  5,  1,  1,  5,  1,  1};	\
  dtype rawrefgreq[] = {  1,  1,  5,  5,  1,  1,  5,  1,  1,  5};	\
  dtype rawrefgr[]   = {  5,  5,  5,  5,  1,  5,  5,  1,  5,  5};	\
  dtype rawrefl[]    = {  5,  5,  1,  1,  5,  5,  1,  5,  5,  1};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattst, *dattrue;					\
  FLGR_Vector *vec_false;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattst     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattrue    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattst,rawtst);					\
  flgr1d_import_raw_ptr(dattrue,rawtrue);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"==",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"!=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"<=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"<",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,">=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,">",dattst,		\
				  dattrue,vec_false);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattst);						\
  flgr1d_destroy(dattrue);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
									\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace1d_I_with_I_I_C_fgUINT8(void) {
  tstReplace1d_I_with_I_I_C(fgUINT8);
}

int testreplace1d_I_with_I_I_C_fgUINT16(void) {
  tstReplace1d_I_with_I_I_C(fgUINT16);
}

int testreplace1d_I_with_I_I_C_fgUINT32(void) {
  tstReplace1d_I_with_I_I_C(fgUINT32);
}

int testreplace1d_I_with_I_I_C_fgINT8(void) {
  tstReplace1d_I_with_I_I_C(fgINT8);
}

int testreplace1d_I_with_I_I_C_fgINT16(void) {
  tstReplace1d_I_with_I_I_C(fgINT16);
}

int testreplace1d_I_with_I_I_C_fgINT32(void) {
  tstReplace1d_I_with_I_I_C(fgINT32);
}

int testreplace1d_I_with_I_I_C_fgFLOAT32(void) {
  tstReplace1d_I_with_I_I_C(fgFLOAT32);
}

int testreplace1d_I_with_I_I_C_fgFLOAT64(void) {
  tstReplace1d_I_with_I_I_C(fgFLOAT64);
}










/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_C types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_spp2_I_with_I_I_C(dtype)				\
									\
  dtype rawsrc[]     = {  0,0,   5,5,   6,6,   0,0,   8,8,   0,0,   2,2,   6,6,   7,7,   0,0}; \
  dtype rawtst[]     = {  0,0,   5,5,   7,7,   1,1,   0,0,   0,0,   3,3,   0,0,   7,7,   9,9}; \
									\
  dtype rawtrue[]    = {  1,1,   1,1,   1,1,   1,1,   1,1,   1,1,   1,1,   1,1,   1,1,   1,1}; \
  dtype vfalse       = 5;						\
									\
  dtype rawref[]     = {  1,1,   1,1,   5,5,   5,5,   5,5,   1,1,   5,5,   5,5,   1,1,   5,5}; \
  dtype rawrefdif[]  = {  5,5,   5,5,   1,1,   1,1,   1,1,   5,5,   1,1,   1,1,   5,5,   1,1}; \
  dtype rawrefleq[]  = {  1,1,   1,1,   1,1,   1,1,   5,5,   1,1,   1,1,   5,5,   1,1,   1,1}; \
  dtype rawrefgreq[] = {  1,1,   1,1,   5,5,   5,5,   1,1,   1,1,   5,5,   1,1,   1,1,   5,5}; \
  dtype rawrefgr[]   = {  5,5,   5,5,   5,5,   5,5,   1,1,   5,5,   5,5,   1,1,   5,5,   5,5}; \
  dtype rawrefl[]    = {  5,5,   5,5,   1,1,   1,1,   5,5,   5,5,   1,1,   5,5,   5,5,   1,1}; \
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattst, *dattrue;					\
  FLGR_Vector *vec_false;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  dattst     = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  dattrue    = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,2,FLGR_NO_SHAPE);		\
									\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
  									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattst,rawtst);					\
  flgr1d_import_raw_ptr(dattrue,rawtrue);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"==",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"!=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"<=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,"<",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,">=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_I_I_C(datdest,datsrc,">",dattst,		\
				  dattrue,vec_false);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattst);						\
  flgr1d_destroy(dattrue);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
									\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace1d_spp2_I_with_I_I_C_fgUINT8(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgUINT8);
}

int testreplace1d_spp2_I_with_I_I_C_fgUINT16(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgUINT16);
}

int testreplace1d_spp2_I_with_I_I_C_fgUINT32(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgUINT32);
}

int testreplace1d_spp2_I_with_I_I_C_fgINT8(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgINT8);
}

int testreplace1d_spp2_I_with_I_I_C_fgINT16(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgINT16);
}

int testreplace1d_spp2_I_with_I_I_C_fgINT32(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgINT32);
}

int testreplace1d_spp2_I_with_I_I_C_fgFLOAT32(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgFLOAT32);
}

int testreplace1d_spp2_I_with_I_I_C_fgFLOAT64(void) {
  tstReplace1d_spp2_I_with_I_I_C(fgFLOAT64);
}














/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_C_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_I_C_I(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype rawtst[]     = {  0,  5,  7,  1,  0,  0,  3,  0,  7,  9};	\
									\
  dtype vtrue        = 1;						\
  dtype rawfalse[]   = {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0};	\
									\
  dtype rawref[]     = {  1,  1,  0,  0,  0,  1,  0,  0,  1,  0};	\
  dtype rawrefdif[]  = {  0,  0,  1,  1,  1,  0,  1,  1,  0,  1};	\
  dtype rawrefleq[]  = {  1,  1,  1,  1,  0,  1,  1,  0,  1,  1};	\
  dtype rawrefgreq[] = {  1,  1,  0,  0,  1,  1,  0,  1,  1,  0};	\
  dtype rawrefgr[]   = {  0,  0,  0,  0,  1,  0,  0,  1,  0,  0};	\
  dtype rawrefl[]    = {  0,  0,  1,  1,  0,  0,  1,  0,  0,  1};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattst, *datfalse;					\
  FLGR_Vector *vec_true;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattst     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datfalse   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattst,rawtst);					\
  flgr1d_import_raw_ptr(datfalse,rawfalse);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_I_C_I(datdest,datsrc,"==",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_I_C_I(datdest,datsrc,"!=",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_C_I(datdest,datsrc,"<=",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_I_C_I(datdest,datsrc,"<",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_C_I(datdest,datsrc,">=",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_I_C_I(datdest,datsrc,">",dattst,		\
				  vec_true,datfalse);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattst);						\
  flgr1d_destroy(datfalse);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_true);					\
									\
  return 6


int testreplace1d_I_with_I_C_I_fgUINT8(void) {
  tstReplace1d_I_with_I_C_I(fgUINT8);
}

int testreplace1d_I_with_I_C_I_fgUINT16(void) {
  tstReplace1d_I_with_I_C_I(fgUINT16);
}

int testreplace1d_I_with_I_C_I_fgUINT32(void) {
  tstReplace1d_I_with_I_C_I(fgUINT32);
}

int testreplace1d_I_with_I_C_I_fgINT8(void) {
  tstReplace1d_I_with_I_C_I(fgINT8);
}

int testreplace1d_I_with_I_C_I_fgINT16(void) {
  tstReplace1d_I_with_I_C_I(fgINT16);
}

int testreplace1d_I_with_I_C_I_fgINT32(void) {
  tstReplace1d_I_with_I_C_I(fgINT32);
}

int testreplace1d_I_with_I_C_I_fgFLOAT32(void) {
  tstReplace1d_I_with_I_C_I(fgFLOAT32);
}

int testreplace1d_I_with_I_C_I_fgFLOAT64(void) {
  tstReplace1d_I_with_I_C_I(fgFLOAT64);
}



/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_C_C types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_I_C_C(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype rawtst[]     = {  0,  5,  7,  1,  0,  0,  3,  0,  7,  9};	\
									\
  dtype vtrue        = 1;						\
  dtype vfalse       = 5;						\
									\
  dtype rawref[]     = {  1,  1,  5,  5,  5,  1,  5,  5,  1,  5};	\
  dtype rawrefdif[]  = {  5,  5,  1,  1,  1,  5,  1,  1,  5,  1};	\
  dtype rawrefleq[]  = {  1,  1,  1,  1,  5,  1,  1,  5,  1,  1};	\
  dtype rawrefgreq[] = {  1,  1,  5,  5,  1,  1,  5,  1,  1,  5};	\
  dtype rawrefgr[]   = {  5,  5,  5,  5,  1,  5,  5,  1,  5,  5};	\
  dtype rawrefl[]    = {  5,  5,  1,  1,  5,  5,  1,  5,  5,  1};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattst;							\
  FLGR_Vector *vec_false;						\
  FLGR_Vector *vec_true;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattst     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattst,rawtst);					\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_I_C_C(datdest,datsrc,"==",dattst,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_I_C_C(datdest,datsrc,"!=",dattst,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_C_C(datdest,datsrc,"<=",dattst,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_I_C_C(datdest,datsrc,"<",dattst,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_I_C_C(datdest,datsrc,">=",dattst,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_I_C_C(datdest,datsrc,">",dattst,		\
				  vec_true,vec_false);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattst);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_true);					\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace1d_I_with_I_C_C_fgUINT8(void) {
  tstReplace1d_I_with_I_C_C(fgUINT8);
}

int testreplace1d_I_with_I_C_C_fgUINT16(void) {
  tstReplace1d_I_with_I_C_C(fgUINT16);
}

int testreplace1d_I_with_I_C_C_fgUINT32(void) {
  tstReplace1d_I_with_I_C_C(fgUINT32);
}

int testreplace1d_I_with_I_C_C_fgINT8(void) {
  tstReplace1d_I_with_I_C_C(fgINT8);
}

int testreplace1d_I_with_I_C_C_fgINT16(void) {
  tstReplace1d_I_with_I_C_C(fgINT16);
}

int testreplace1d_I_with_I_C_C_fgINT32(void) {
  tstReplace1d_I_with_I_C_C(fgINT32);
}

int testreplace1d_I_with_I_C_C_fgFLOAT32(void) {
  tstReplace1d_I_with_I_C_C(fgFLOAT32);
}

int testreplace1d_I_with_I_C_C_fgFLOAT64(void) {
  tstReplace1d_I_with_I_C_C(fgFLOAT64);
}








/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_C_I_I(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype vtest=2;							\
									\
  dtype rawtrue[]    = {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1};	\
  dtype rawfalse[]   = {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0};	\
									\
  dtype rawref[]     = {  0,  0,  0,  0,  0,  0,  1,  0,  0,  0};	\
  dtype rawrefdif[]  = {  1,  1,  1,  1,  1,  1,  0,  1,  1,  1};	\
  dtype rawrefleq[]  = {  1,  0,  0,  1,  0,  1,  1,  0,  0,  1};	\
  dtype rawrefgreq[] = {  0,  1,  1,  0,  1,  0,  1,  1,  1,  0};	\
  dtype rawrefgr[]   = {  0,  1,  1,  0,  1,  0,  0,  1,  1,  0};	\
  dtype rawrefl[]    = {  1,  0,  0,  1,  0,  1,  0,  0,  0,  1};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattrue, *datfalse;					\
  FLGR_Vector *vec_test;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattrue    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datfalse   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattrue,rawtrue);				\
  flgr1d_import_raw_ptr(datfalse,rawfalse);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_C_I_I(datdest,datsrc,"==",vec_test,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_C_I_I(datdest,datsrc,"!=",vec_test,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_I_I(datdest,datsrc,"<=",vec_test,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_C_I_I(datdest,datsrc,"<",vec_test,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_I_I(datdest,datsrc,">=",vec_test,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_C_I_I(datdest,datsrc,">",vec_test,		\
				  dattrue,datfalse);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattrue);						\
  flgr1d_destroy(datfalse);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  return 6


int testreplace1d_I_with_C_I_I_fgUINT8(void) {
  tstReplace1d_I_with_C_I_I(fgUINT8);
}

int testreplace1d_I_with_C_I_I_fgUINT16(void) {
  tstReplace1d_I_with_C_I_I(fgUINT16);
}

int testreplace1d_I_with_C_I_I_fgUINT32(void) {
  tstReplace1d_I_with_C_I_I(fgUINT32);
}

int testreplace1d_I_with_C_I_I_fgINT8(void) {
  tstReplace1d_I_with_C_I_I(fgINT8);
}

int testreplace1d_I_with_C_I_I_fgINT16(void) {
  tstReplace1d_I_with_C_I_I(fgINT16);
}

int testreplace1d_I_with_C_I_I_fgINT32(void) {
  tstReplace1d_I_with_C_I_I(fgINT32);
}

int testreplace1d_I_with_C_I_I_fgFLOAT32(void) {
  tstReplace1d_I_with_C_I_I(fgFLOAT32);
}

int testreplace1d_I_with_C_I_I_fgFLOAT64(void) {
  tstReplace1d_I_with_C_I_I(fgFLOAT64);
}






/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_C_I_C(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype vtest=2;							\
									\
  dtype rawtrue[]    = {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1};	\
  dtype vfalse = 8;							\
									\
  dtype rawref[]     = {  8,  8,  8,  8,  8,  8,  1,  8,  8,  8};	\
  dtype rawrefdif[]  = {  1,  1,  1,  1,  1,  1,  8,  1,  1,  1};	\
  dtype rawrefleq[]  = {  1,  8,  8,  1,  8,  1,  1,  8,  8,  1};	\
  dtype rawrefgreq[] = {  8,  1,  1,  8,  1,  8,  1,  1,  1,  8};	\
  dtype rawrefgr[]   = {  8,  1,  1,  8,  1,  8,  8,  1,  1,  8};	\
  dtype rawrefl[]    = {  1,  8,  8,  1,  8,  1,  8,  8,  8,  1};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *dattrue;							\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_false;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  dattrue    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(dattrue,rawtrue);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_C_I_C(datdest,datsrc,"==",vec_test,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_C_I_C(datdest,datsrc,"!=",vec_test,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_I_C(datdest,datsrc,"<=",vec_test,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_C_I_C(datdest,datsrc,"<",vec_test,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_I_C(datdest,datsrc,">=",vec_test,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_C_I_C(datdest,datsrc,">",vec_test,		\
				  dattrue,vec_false);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(dattrue);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace1d_I_with_C_I_C_fgUINT8(void) {
  tstReplace1d_I_with_C_I_C(fgUINT8);
}

int testreplace1d_I_with_C_I_C_fgUINT16(void) {
  tstReplace1d_I_with_C_I_C(fgUINT16);
}

int testreplace1d_I_with_C_I_C_fgUINT32(void) {
  tstReplace1d_I_with_C_I_C(fgUINT32);
}

int testreplace1d_I_with_C_I_C_fgINT8(void) {
  tstReplace1d_I_with_C_I_C(fgINT8);
}

int testreplace1d_I_with_C_I_C_fgINT16(void) {
  tstReplace1d_I_with_C_I_C(fgINT16);
}

int testreplace1d_I_with_C_I_C_fgINT32(void) {
  tstReplace1d_I_with_C_I_C(fgINT32);
}

int testreplace1d_I_with_C_I_C_fgFLOAT32(void) {
  tstReplace1d_I_with_C_I_C(fgFLOAT32);
}

int testreplace1d_I_with_C_I_C_fgFLOAT64(void) {
  tstReplace1d_I_with_C_I_C(fgFLOAT64);
}





/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_C_C_I(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype vtest=2;							\
									\
  dtype vtrue = 2;							\
  dtype rawfalse[]   = {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0};	\
									\
  dtype rawref[]     = {  0,  0,  0,  0,  0,  0,  2,  0,  0,  0};	\
  dtype rawrefdif[]  = {  2,  2,  2,  2,  2,  2,  0,  2,  2,  2};	\
  dtype rawrefleq[]  = {  2,  0,  0,  2,  0,  2,  2,  0,  0,  2};	\
  dtype rawrefgreq[] = {  0,  2,  2,  0,  2,  0,  2,  2,  2,  0};	\
  dtype rawrefgr[]   = {  0,  2,  2,  0,  2,  0,  0,  2,  2,  0};	\
  dtype rawrefl[]    = {  2,  0,  0,  2,  0,  2,  0,  0,  0,  2};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Data1D *datfalse;						\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_true;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datfalse   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(datfalse,rawfalse);				\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_C_C_I(datdest,datsrc,"==",vec_test,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_C_C_I(datdest,datsrc,"!=",vec_test,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_C_I(datdest,datsrc,"<=",vec_test,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_C_C_I(datdest,datsrc,"<",vec_test,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_C_I(datdest,datsrc,">=",vec_test,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_C_C_I(datdest,datsrc,">",vec_test,		\
				  vec_true,datfalse);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(datfalse);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_true);					\
									\
  return 6


int testreplace1d_I_with_C_C_I_fgUINT8(void) {
  tstReplace1d_I_with_C_C_I(fgUINT8);
}

int testreplace1d_I_with_C_C_I_fgUINT16(void) {
  tstReplace1d_I_with_C_C_I(fgUINT16);
}

int testreplace1d_I_with_C_C_I_fgUINT32(void) {
  tstReplace1d_I_with_C_C_I(fgUINT32);
}

int testreplace1d_I_with_C_C_I_fgINT8(void) {
  tstReplace1d_I_with_C_C_I(fgINT8);
}

int testreplace1d_I_with_C_C_I_fgINT16(void) {
  tstReplace1d_I_with_C_C_I(fgINT16);
}

int testreplace1d_I_with_C_C_I_fgINT32(void) {
  tstReplace1d_I_with_C_C_I(fgINT32);
}

int testreplace1d_I_with_C_C_I_fgFLOAT32(void) {
  tstReplace1d_I_with_C_C_I(fgFLOAT32);
}

int testreplace1d_I_with_C_C_I_fgFLOAT64(void) {
  tstReplace1d_I_with_C_C_I(fgFLOAT64);
}





/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr1d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace1d_I_with_C_C_C(dtype)				\
									\
  dtype rawsrc[]     = {  0,  5,  6,  0,  8,  0,  2,  6,  7,  0};	\
  dtype vtest=2;							\
									\
  dtype vtrue = 2;							\
  dtype vfalse = 9;							\
									\
  dtype rawref[]     = {  9,  9,  9,  9,  9,  9,  2,  9,  9,  9};	\
  dtype rawrefdif[]  = {  2,  2,  2,  2,  2,  2,  9,  2,  2,  2};	\
  dtype rawrefleq[]  = {  2,  9,  9,  2,  9,  2,  2,  9,  9,  2};	\
  dtype rawrefgreq[] = {  9,  2,  2,  9,  2,  9,  2,  2,  2,  9};	\
  dtype rawrefgr[]   = {  9,  2,  2,  9,  2,  9,  9,  2,  2,  9};	\
  dtype rawrefl[]    = {  2,  9,  9,  2,  9,  2,  9,  9,  9,  2};	\
									\
  FLGR_Data1D *datsrc, *datref, *datdest;				\
  FLGR_Data1D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data1D *datrefgr;						\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_true;						\
  FLGR_Vector *vec_false;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datdest    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datref     = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefleq  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefl    = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgr   = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefgreq = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
  datrefdif  = flgr1d_create_##dtype(10,1,FLGR_NO_SHAPE);		\
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
									\
  flgr1d_import_raw_ptr(datsrc,rawsrc);					\
  flgr1d_import_raw_ptr(datref,rawref);					\
  flgr1d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr1d_import_raw_ptr(datrefl,rawrefl);				\
  flgr1d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr1d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr1d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr1d_replace_I_with_C_C_C(datdest,datsrc,"==",vec_test,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr1d_replace_I_with_C_C_C(datdest,datsrc,"!=",vec_test,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_C_C(datdest,datsrc,"<=",vec_test,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr1d_replace_I_with_C_C_C(datdest,datsrc,"<",vec_test,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr1d_replace_I_with_C_C_C(datdest,datsrc,">=",vec_test,		\
				  vec_true,vec_false);			\
									\
  check_and_display_data1d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr1d_replace_I_with_C_C_C(datdest,datsrc,">",vec_test,		\
				  vec_true,vec_false);			\
  check_and_display_data1d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr1d_destroy(datsrc);						\
  flgr1d_destroy(datdest);						\
  flgr1d_destroy(datref);						\
  flgr1d_destroy(datrefleq);						\
  flgr1d_destroy(datrefl);						\
  flgr1d_destroy(datrefdif);						\
  flgr1d_destroy(datrefgreq);						\
  flgr1d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_false);					\
  flgr_vector_destroy(vec_true);					\
									\
  return 6


int testreplace1d_I_with_C_C_C_fgUINT8(void) {
  tstReplace1d_I_with_C_C_C(fgUINT8);
}

int testreplace1d_I_with_C_C_C_fgUINT16(void) {
  tstReplace1d_I_with_C_C_C(fgUINT16);
}

int testreplace1d_I_with_C_C_C_fgUINT32(void) {
  tstReplace1d_I_with_C_C_C(fgUINT32);
}

int testreplace1d_I_with_C_C_C_fgINT8(void) {
  tstReplace1d_I_with_C_C_C(fgINT8);
}

int testreplace1d_I_with_C_C_C_fgINT16(void) {
  tstReplace1d_I_with_C_C_C(fgINT16);
}

int testreplace1d_I_with_C_C_C_fgINT32(void) {
  tstReplace1d_I_with_C_C_C(fgINT32);
}

int testreplace1d_I_with_C_C_C_fgFLOAT32(void) {
  tstReplace1d_I_with_C_C_C(fgFLOAT32);
}

int testreplace1d_I_with_C_C_C_fgFLOAT64(void) {
  tstReplace1d_I_with_C_C_C(fgFLOAT64);
}






































/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_I_I_I(dtype)				\
									\
  dtype rawsrc[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  50, 44, 42, 32,123,112,100, 88, 82, 73,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  98, 96, 99,102, 98, 93,100, 99, 94, 96,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
  dtype rawtst[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  49, 43, 41, 31,122,111, 99, 87, 81, 72,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  99, 97,100,103, 99, 94,101,100, 95, 97,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
									\
  dtype rawtrue[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawfalse[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawref[]={127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127};		\
									\
									\
  dtype rawrefdif[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgreq[]={127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgr[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefl[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *dattst, *dattrue, *datfalse;				\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattst     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattrue    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datfalse   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(dattst,rawtst);					\
  flgr2d_import_raw_ptr(dattrue,rawtrue);				\
  flgr2d_import_raw_ptr(datfalse,rawfalse);				\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_I_I_I(datdest,datsrc,"==",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_I_I_I(datdest,datsrc,"!=",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_I_I(datdest,datsrc,"<=",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_I_I_I(datdest,datsrc,"<",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_I_I(datdest,datsrc,">=",dattst,		\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_I_I_I(datdest,datsrc,">",dattst,		\
				  dattrue,datfalse);			\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(dattst);						\
  flgr2d_destroy(dattrue);						\
  flgr2d_destroy(datfalse);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
									\
  return 6


int testreplace2d_I_with_I_I_I_fgUINT8(void) {
  tstReplace2d_I_with_I_I_I(fgUINT8);
}

int testreplace2d_I_with_I_I_I_fgUINT16(void) {
  tstReplace2d_I_with_I_I_I(fgUINT16);
}

int testreplace2d_I_with_I_I_I_fgUINT32(void) {
  tstReplace2d_I_with_I_I_I(fgUINT32);
}

int testreplace2d_I_with_I_I_I_fgINT8(void) {
  tstReplace2d_I_with_I_I_I(fgINT8);
}

int testreplace2d_I_with_I_I_I_fgINT16(void) {
  tstReplace2d_I_with_I_I_I(fgINT16);
}

int testreplace2d_I_with_I_I_I_fgINT32(void) {
  tstReplace2d_I_with_I_I_I(fgINT32);
}

int testreplace2d_I_with_I_I_I_fgFLOAT32(void) {
  tstReplace2d_I_with_I_I_I(fgFLOAT32);
}

int testreplace2d_I_with_I_I_I_fgFLOAT64(void) {
  tstReplace2d_I_with_I_I_I(fgFLOAT64);
}






/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_C types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_I_I_C(dtype)				\
									\
  dtype rawsrc[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  50, 44, 42, 32,123,112,100, 88, 82, 73,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  98, 96, 99,102, 98, 93,100, 99, 94, 96,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
  dtype rawtst[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  49, 43, 41, 31,122,111, 99, 87, 81, 72,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  99, 97,100,103, 99, 94,101,100, 95, 97,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
									\
  dtype rawtrue[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype vfalse = 0;							\
									\
  dtype rawref[]={127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127};		\
									\
									\
  dtype rawrefdif[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgreq[]={127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgr[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefl[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *dattst, *dattrue;					\
  FLGR_Ret ret;								\
  FLGR_Vector *vec_false;						\
 									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattst     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattrue    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(dattst,rawtst);					\
  flgr2d_import_raw_ptr(dattrue,rawtrue);				\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_I_I_C(datdest,datsrc,"==",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_I_I_C(datdest,datsrc,"!=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_I_C(datdest,datsrc,"<=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_I_I_C(datdest,datsrc,"<",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_I_C(datdest,datsrc,">=",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_I_I_C(datdest,datsrc,">",dattst,		\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(dattst);						\
  flgr2d_destroy(dattrue);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace2d_I_with_I_I_C_fgUINT8(void) {
  tstReplace2d_I_with_I_I_C(fgUINT8);
}

int testreplace2d_I_with_I_I_C_fgUINT16(void) {
  tstReplace2d_I_with_I_I_C(fgUINT16);
}

int testreplace2d_I_with_I_I_C_fgUINT32(void) {
  tstReplace2d_I_with_I_I_C(fgUINT32);
}

int testreplace2d_I_with_I_I_C_fgINT8(void) {
  tstReplace2d_I_with_I_I_C(fgINT8);
}

int testreplace2d_I_with_I_I_C_fgINT16(void) {
  tstReplace2d_I_with_I_I_C(fgINT16);
}

int testreplace2d_I_with_I_I_C_fgINT32(void) {
  tstReplace2d_I_with_I_I_C(fgINT32);
}

int testreplace2d_I_with_I_I_C_fgFLOAT32(void) {
  tstReplace2d_I_with_I_I_C(fgFLOAT32);
}

int testreplace2d_I_with_I_I_C_fgFLOAT64(void) {
  tstReplace2d_I_with_I_I_C(fgFLOAT64);
}








/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_C_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_I_C_I(dtype)				\
									\
  dtype rawsrc[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  50, 44, 42, 32,123,112,100, 88, 82, 73,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  98, 96, 99,102, 98, 93,100, 99, 94, 96,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
  dtype rawtst[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  49, 43, 41, 31,122,111, 99, 87, 81, 72,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  99, 97,100,103, 99, 94,101,100, 95, 97,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
									\
  dtype vtrue=127;							\
									\
  dtype rawfalse[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawref[]={127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127};		\
									\
									\
  dtype rawrefdif[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgreq[]={127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgr[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefl[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *dattst, *dattrue, *datfalse;				\
  FLGR_Ret ret;								\
  FLGR_Vector *vec_true;						\
 									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattst     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattrue    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datfalse   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(dattst,rawtst);					\
  flgr2d_import_raw_ptr(datfalse,rawfalse);				\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_I_C_I(datdest,datsrc,"==",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_I_C_I(datdest,datsrc,"!=",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_C_I(datdest,datsrc,"<=",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_I_C_I(datdest,datsrc,"<",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_C_I(datdest,datsrc,">=",dattst,		\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_I_C_I(datdest,datsrc,">",dattst,		\
				  vec_true,datfalse);			\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(dattst);						\
  flgr2d_destroy(dattrue);						\
  flgr2d_destroy(datfalse);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_true);					\
 									\
  return 6


int testreplace2d_I_with_I_C_I_fgUINT8(void) {
  tstReplace2d_I_with_I_C_I(fgUINT8);
}

int testreplace2d_I_with_I_C_I_fgUINT16(void) {
  tstReplace2d_I_with_I_C_I(fgUINT16);
}

int testreplace2d_I_with_I_C_I_fgUINT32(void) {
  tstReplace2d_I_with_I_C_I(fgUINT32);
}

int testreplace2d_I_with_I_C_I_fgINT8(void) {
  tstReplace2d_I_with_I_C_I(fgINT8);
}

int testreplace2d_I_with_I_C_I_fgINT16(void) {
  tstReplace2d_I_with_I_C_I(fgINT16);
}

int testreplace2d_I_with_I_C_I_fgINT32(void) {
  tstReplace2d_I_with_I_C_I(fgINT32);
}

int testreplace2d_I_with_I_C_I_fgFLOAT32(void) {
  tstReplace2d_I_with_I_C_I(fgFLOAT32);
}

int testreplace2d_I_with_I_C_I_fgFLOAT64(void) {
  tstReplace2d_I_with_I_C_I(fgFLOAT64);
}











/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_I_C_C(dtype)				\
									\
  dtype rawsrc[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  50, 44, 42, 32,123,112,100, 88, 82, 73,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  98, 96, 99,102, 98, 93,100, 99, 94, 96,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
  dtype rawtst[]={105,115, 28, 41, 41, 48, 54, 57, 62, 70,		\
		  72, 76, 75, 76, 76, 78, 75, 77, 78, 76,		\
		  75, 79, 77, 76, 77, 73, 71, 64, 62, 55,		\
		  49, 43, 41, 31,122,111, 99, 87, 81, 72,		\
		  73, 76, 76, 81, 85, 86, 90, 90, 93, 92,		\
		  91, 96, 96,100, 96, 98, 98, 97,102, 99,		\
		  99, 97,100,103, 99, 94,101,100, 95, 97,		\
		  94, 90, 88, 87, 88, 88, 85, 87, 35,  5};		\
									\
  dtype vtrue=127,vfalse=0;						\
									\
  dtype rawref[]={127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  127,127,127,127,127,127,127,127,127,127,		\
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		  127,127,127,127,127,127,127,127,127,127};		\
									\
									\
  dtype rawrefdif[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		       127,127,127,127,127,127,127,127,127,127,		\
		       0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgreq[]={127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefgr[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,127,127,127,127,127,127,127,127,127,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawrefl[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *dattst, *dattrue, *datfalse;				\
  FLGR_Ret ret;								\
  FLGR_Vector *vec_true;						\
  FLGR_Vector *vec_false;						\
									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattst     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattrue    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datfalse   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(dattst,rawtst);					\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_I_C_C(datdest,datsrc,"==",dattst,		\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_I_C_C(datdest,datsrc,"!=",dattst,		\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_C_C(datdest,datsrc,"<=",dattst,		\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_I_C_C(datdest,datsrc,"<",dattst,		\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_I_C_C(datdest,datsrc,">=",dattst,		\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_I_C_C(datdest,datsrc,">",dattst,		\
				  vec_true,				\
				  vec_false);				\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(dattst);						\
  flgr2d_destroy(dattrue);						\
  flgr2d_destroy(datfalse);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_true);					\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace2d_I_with_I_C_C_fgUINT8(void) {
  tstReplace2d_I_with_I_C_C(fgUINT8);
}

int testreplace2d_I_with_I_C_C_fgUINT16(void) {
  tstReplace2d_I_with_I_C_C(fgUINT16);
}

int testreplace2d_I_with_I_C_C_fgUINT32(void) {
  tstReplace2d_I_with_I_C_C(fgUINT32);
}

int testreplace2d_I_with_I_C_C_fgINT8(void) {
  tstReplace2d_I_with_I_C_C(fgINT8);
}

int testreplace2d_I_with_I_C_C_fgINT16(void) {
  tstReplace2d_I_with_I_C_C(fgINT16);
}

int testreplace2d_I_with_I_C_C_fgINT32(void) {
  tstReplace2d_I_with_I_C_C(fgINT32);
}

int testreplace2d_I_with_I_C_C_fgFLOAT32(void) {
  tstReplace2d_I_with_I_C_C(fgFLOAT32);
}

int testreplace2d_I_with_I_C_C_fgFLOAT64(void) {
  tstReplace2d_I_with_I_C_C(fgFLOAT64);
}







/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_C_I_I(dtype)				\
									\
  dtype rawsrc[]={ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,		\
		   20, 21, 22, 23, 24, 25, 26, 27, 28, 29,		\
		   30, 31, 32, 33, 34, 35, 36, 37, 38, 39,		\
		   40, 41, 42, 43, 44, 45, 46, 47, 48, 49,		\
		   50, 51, 52, 53, 54, 55, 56, 57, 58, 59,		\
		   60, 61, 62, 63, 64, 65, 66, 67, 68, 69,		\
		   70, 71, 72, 73, 74, 75, 76, 77, 78, 79,		\
		   80, 81, 82, 83, 84, 85, 86, 87, 88, 89};		\
									\
  dtype vtest =  40;							\
									\
  dtype rawtrue[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawfalse[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawref[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefdif[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefgreq[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefgr[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,127,127,127,127,127,127,127,127,127,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefl[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *dattrue, *datfalse;					\
  FLGR_Ret ret;								\
  FLGR_Vector *vec_test;						\
									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattrue    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datfalse   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(dattrue,rawtrue);				\
  flgr2d_import_raw_ptr(datfalse,rawfalse);				\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_C_I_I(datdest,				\
				  datsrc,"==",vec_test,			\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_C_I_I(datdest,				\
				  datsrc,"!=",vec_test,			\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_I_I(datdest,				\
				  datsrc,"<=",vec_test,			\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_C_I_I(datdest,				\
				  datsrc,"<",vec_test,			\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_I_I(datdest,				\
				  datsrc,">=",vec_test,			\
				  dattrue,datfalse);			\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_C_I_I(datdest,				\
				  datsrc,">",vec_test,			\
				  dattrue,datfalse);			\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(dattrue);						\
  flgr2d_destroy(datfalse);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
									\
  return 6


int testreplace2d_I_with_C_I_I_fgUINT8(void) {
  tstReplace2d_I_with_C_I_I(fgUINT8);
}

int testreplace2d_I_with_C_I_I_fgUINT16(void) {
  tstReplace2d_I_with_C_I_I(fgUINT16);
}

int testreplace2d_I_with_C_I_I_fgUINT32(void) {
  tstReplace2d_I_with_C_I_I(fgUINT32);
}

int testreplace2d_I_with_C_I_I_fgINT8(void) {
  tstReplace2d_I_with_C_I_I(fgINT8);
}

int testreplace2d_I_with_C_I_I_fgINT16(void) {
  tstReplace2d_I_with_C_I_I(fgINT16);
}

int testreplace2d_I_with_C_I_I_fgINT32(void) {
  tstReplace2d_I_with_C_I_I(fgINT32);
}

int testreplace2d_I_with_C_I_I_fgFLOAT32(void) {
  tstReplace2d_I_with_C_I_I(fgFLOAT32);
}

int testreplace2d_I_with_C_I_I_fgFLOAT64(void) {
  tstReplace2d_I_with_C_I_I(fgFLOAT64);
}







/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_C_I_C(dtype)				\
									\
  dtype rawsrc[]={ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,		\
		   20, 21, 22, 23, 24, 25, 26, 27, 28, 29,		\
		   30, 31, 32, 33, 34, 35, 36, 37, 38, 39,		\
		   40, 41, 42, 43, 44, 45, 46, 47, 48, 49,		\
		   50, 51, 52, 53, 54, 55, 56, 57, 58, 59,		\
		   60, 61, 62, 63, 64, 65, 66, 67, 68, 69,		\
		   70, 71, 72, 73, 74, 75, 76, 77, 78, 79,		\
		   80, 81, 82, 83, 84, 85, 86, 87, 88, 89};		\
									\
  dtype vtest =  40;							\
									\
  dtype rawtrue[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype vfalse = 0;							\
									\
  dtype rawref[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefdif[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefgreq[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefgr[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,127,127,127,127,127,127,127,127,127,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefl[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *dattrue;							\
  FLGR_Ret ret;								\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_false;						\
									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  dattrue    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
									\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(dattrue,rawtrue);				\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_C_I_C(datdest,				\
				  datsrc,"==",vec_test,			\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_C_I_C(datdest,				\
				  datsrc,"!=",vec_test,			\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_I_C(datdest,				\
				  datsrc,"<=",vec_test,			\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_C_I_C(datdest,				\
				  datsrc,"<",vec_test,			\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_I_C(datdest,				\
				  datsrc,">=",vec_test,			\
				  dattrue,vec_false);			\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_C_I_C(datdest,				\
				  datsrc,">",vec_test,			\
				  dattrue,vec_false);			\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(dattrue);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_false);					\
									\
  return 6


int testreplace2d_I_with_C_I_C_fgUINT8(void) {
  tstReplace2d_I_with_C_I_C(fgUINT8);
}

int testreplace2d_I_with_C_I_C_fgUINT16(void) {
  tstReplace2d_I_with_C_I_C(fgUINT16);
}

int testreplace2d_I_with_C_I_C_fgUINT32(void) {
  tstReplace2d_I_with_C_I_C(fgUINT32);
}

int testreplace2d_I_with_C_I_C_fgINT8(void) {
  tstReplace2d_I_with_C_I_C(fgINT8);
}

int testreplace2d_I_with_C_I_C_fgINT16(void) {
  tstReplace2d_I_with_C_I_C(fgINT16);
}

int testreplace2d_I_with_C_I_C_fgINT32(void) {
  tstReplace2d_I_with_C_I_C(fgINT32);
}

int testreplace2d_I_with_C_I_C_fgFLOAT32(void) {
  tstReplace2d_I_with_C_I_C(fgFLOAT32);
}

int testreplace2d_I_with_C_I_C_fgFLOAT64(void) {
  tstReplace2d_I_with_C_I_C(fgFLOAT64);
}








/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_C_C_I(dtype)				\
									\
  dtype rawsrc[]={ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,		\
		   20, 21, 22, 23, 24, 25, 26, 27, 28, 29,		\
		   30, 31, 32, 33, 34, 35, 36, 37, 38, 39,		\
		   40, 41, 42, 43, 44, 45, 46, 47, 48, 49,		\
		   50, 51, 52, 53, 54, 55, 56, 57, 58, 59,		\
		   60, 61, 62, 63, 64, 65, 66, 67, 68, 69,		\
		   70, 71, 72, 73, 74, 75, 76, 77, 78, 79,		\
		   80, 81, 82, 83, 84, 85, 86, 87, 88, 89};		\
									\
  dtype vtest =  40;							\
  dtype vtrue = 127;							\
									\
									\
  dtype rawfalse[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  dtype rawref[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefdif[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefgreq[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefgr[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,127,127,127,127,127,127,127,127,127,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefl[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Data2D *datfalse;						\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_true;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datfalse   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(datfalse,rawfalse);				\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_C_C_I(datdest,				\
				  datsrc,"==",vec_test,			\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_C_C_I(datdest,				\
				  datsrc,"!=",vec_test,			\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_C_I(datdest,				\
				  datsrc,"<=",vec_test,			\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_C_C_I(datdest,				\
				  datsrc,"<",vec_test,			\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_C_I(datdest,				\
				  datsrc,">=",vec_test,			\
				  vec_true,datfalse);			\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_C_C_I(datdest,				\
				  datsrc,">",vec_test,			\
				  vec_true,datfalse);			\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(datfalse);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_true);					\
									\
  return 6


int testreplace2d_I_with_C_C_I_fgUINT8(void) {
  tstReplace2d_I_with_C_C_I(fgUINT8);
}

int testreplace2d_I_with_C_C_I_fgUINT16(void) {
  tstReplace2d_I_with_C_C_I(fgUINT16);
}

int testreplace2d_I_with_C_C_I_fgUINT32(void) {
  tstReplace2d_I_with_C_C_I(fgUINT32);
}

int testreplace2d_I_with_C_C_I_fgINT8(void) {
  tstReplace2d_I_with_C_C_I(fgINT8);
}

int testreplace2d_I_with_C_C_I_fgINT16(void) {
  tstReplace2d_I_with_C_C_I(fgINT16);
}

int testreplace2d_I_with_C_C_I_fgINT32(void) {
  tstReplace2d_I_with_C_C_I(fgINT32);
}

int testreplace2d_I_with_C_C_I_fgFLOAT32(void) {
  tstReplace2d_I_with_C_C_I(fgFLOAT32);
}

int testreplace2d_I_with_C_C_I_fgFLOAT64(void) {
  tstReplace2d_I_with_C_C_I(fgFLOAT64);
}






/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_I_with_C_C_C(dtype)				\
									\
  dtype rawsrc[]={ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,		\
		   20, 21, 22, 23, 24, 25, 26, 27, 28, 29,		\
		   30, 31, 32, 33, 34, 35, 36, 37, 38, 39,		\
		   40, 41, 42, 43, 44, 45, 46, 47, 48, 49,		\
		   50, 51, 52, 53, 54, 55, 56, 57, 58, 59,		\
		   60, 61, 62, 63, 64, 65, 66, 67, 68, 69,		\
		   70, 71, 72, 73, 74, 75, 76, 77, 78, 79,		\
		   80, 81, 82, 83, 84, 85, 86, 87, 88, 89};		\
									\
  dtype vtest =  40;							\
  dtype vtrue =  127;							\
  dtype vfalse =  0;							\
									\
									\
  dtype rawref[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		      0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefdif[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     0,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127};		\
									\
  dtype rawrefleq[]={127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,127,127,127,127,127,127,127,127,127,		\
		     127,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		     0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
									\
  dtype rawrefgreq[]={  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefgr[]={    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		        0,127,127,127,127,127,127,127,127,127,		\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127,	\
			127,127,127,127,127,127,127,127,127,127};	\
									\
  dtype rawrefl[]={127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   127,127,127,127,127,127,127,127,127,127,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,		\
		   0,  0,  0,  0,  0,  0,  0,  0,  0,  0};		\
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_true;						\
  FLGR_Vector *vec_false;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,1,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"==",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"!=",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"<=",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"<",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,">=",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,">",vec_test,			\
				  vec_true,				\
				  vec_false);				\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_true);					\
  flgr_vector_destroy(vec_false);					\
  									\
  return 6


int testreplace2d_I_with_C_C_C_fgUINT8(void) {
  tstReplace2d_I_with_C_C_C(fgUINT8);
}

int testreplace2d_I_with_C_C_C_fgUINT16(void) {
  tstReplace2d_I_with_C_C_C(fgUINT16);
}

int testreplace2d_I_with_C_C_C_fgUINT32(void) {
  tstReplace2d_I_with_C_C_C(fgUINT32);
}

int testreplace2d_I_with_C_C_C_fgINT8(void) {
  tstReplace2d_I_with_C_C_C(fgINT8);
}

int testreplace2d_I_with_C_C_C_fgINT16(void) {
  tstReplace2d_I_with_C_C_C(fgINT16);
}

int testreplace2d_I_with_C_C_C_fgINT32(void) {
  tstReplace2d_I_with_C_C_C(fgINT32);
}

int testreplace2d_I_with_C_C_C_fgFLOAT32(void) {
  tstReplace2d_I_with_C_C_C(fgFLOAT32);
}

int testreplace2d_I_with_C_C_C_fgFLOAT64(void) {
  tstReplace2d_I_with_C_C_C(fgFLOAT64);
}










/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_replace_I_with_I_I_I types
/////////////////////////////////////////////////////////////////////////
#define tstReplace2d_spp2_I_with_C_C_C(dtype)				\
									\
  dtype rawsrc[]={ 10,10,  11,11,  12,12,  13,13,  14,14,  15,15,  16,16,  17,17,  18,18,  19,19, \
		   20,20,  21,21,  22,22,  23,23,  24,24,  25,25,  26,26,  27,27,  28,28,  29,29, \
		   30,30,  31,31,  32,32,  33,33,  34,34,  35,35,  36,36,  37,37,  38,38,  39,39, \
		   40,40,  41,41,  42,42,  43,43,  44,44,  45,45,  46,46,  47,47,  48,48,  49,49, \
		   50,50,  51,51,  52,52,  53,53,  54,54,  55,55,  56,56,  57,57,  58,58,  59,59, \
		   60,60,  61,61,  62,62,  63,63,  64,64,  65,65,  66,66,  67,67,  68,68,  69,69, \
		   70,70,  71,71,  72,72,  73,73,  74,74,  75,75,  76,76,  77,77,  78,78,  79,79, \
		   80,80,  81,81,  82,82,  83,83,  84,84,  85,85,  86,86,  87,87,  88,88,  89,89} ; \
									\
  dtype vtest =  40;							\
  dtype vtrue =  127;							\
  dtype vfalse =  0;							\
									\
									\
  dtype rawref[]={    0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      127,127,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		      0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0} ; \
									\
									\
  dtype rawrefdif[]={127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     0,0, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127} ; \
									\
  dtype rawrefleq[]={127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		     127,127,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		     0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		     0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		     0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		     0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0} ; \
									\
									\
  dtype rawrefgreq[]={  0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		        0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		        0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127} ; \
									\
  dtype rawrefgr[]={    0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		        0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		        0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		        0,0, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
			127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127} ; \
									\
  dtype rawrefl[]={127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		   127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		   127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, 127,127, \
		   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0, \
		   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0,   0,0} ; \
									\
  FLGR_Data2D *datsrc, *datref, *datdest;				\
  FLGR_Data2D *datrefleq, *datrefl, *datrefdif, *datrefgreq;		\
  FLGR_Data2D *datrefgr;						\
  FLGR_Vector *vec_test;						\
  FLGR_Vector *vec_true;						\
  FLGR_Vector *vec_false;						\
  FLGR_Ret ret;								\
									\
  datsrc     = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datdest    = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datref     = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefleq  = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefl    = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgr   = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefgreq = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
  datrefdif  = flgr2d_create_##dtype(8,10,2,FLGR_NO_SHAPE,FLGR_NO_CONNEX); \
									\
  vec_test  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_test, &vtest);			\
  vec_false  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_false, &vfalse);			\
  vec_true  = flgr_vector_create(datsrc->spp,datsrc->type);		\
  flgr_vector_populate_from_scalar(vec_true, &vtrue);			\
									\
  flgr2d_import_raw_ptr(datsrc,rawsrc);					\
  flgr2d_import_raw_ptr(datref,rawref);					\
  flgr2d_import_raw_ptr(datrefleq,rawrefleq);				\
  flgr2d_import_raw_ptr(datrefl,rawrefl);				\
  flgr2d_import_raw_ptr(datrefgr,rawrefgr);				\
  flgr2d_import_raw_ptr(datrefdif,rawrefdif);				\
  flgr2d_import_raw_ptr(datrefgreq,rawrefgreq);				\
  									\
  printf("EQUAL:     ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"==",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datref,datdest,ret);				\
									\
  printf("DIFF:      ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"!=",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefdif,datdest,ret);			\
									\
  printf("LESS_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"<=",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefleq,datdest,ret);			\
									\
  printf("LESS:      ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,"<",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefl,datdest,ret);			\
									\
  printf("GREA_EQ:   ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,">=",vec_test,			\
				  vec_true,				\
				  vec_false);				\
									\
  check_and_display_data2d(datrefgreq,datdest,ret);			\
									\
  printf("GREA:      ");						\
  ret=flgr2d_replace_I_with_C_C_C(datdest,				\
				  datsrc,">",vec_test,			\
				  vec_true,				\
				  vec_false);				\
  check_and_display_data2d(datrefgr,datdest,ret);			\
									\
  printf("\n");								\
  flgr2d_destroy(datsrc);						\
  flgr2d_destroy(datdest);						\
  flgr2d_destroy(datref);						\
  flgr2d_destroy(datrefleq);						\
  flgr2d_destroy(datrefl);						\
  flgr2d_destroy(datrefdif);						\
  flgr2d_destroy(datrefgreq);						\
  flgr2d_destroy(datrefgr);						\
  flgr_vector_destroy(vec_test);					\
  flgr_vector_destroy(vec_true);					\
  flgr_vector_destroy(vec_false);					\
  									\
  return 6


int testreplace2d_spp2_I_with_C_C_C_fgUINT8(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgUINT8);
}

int testreplace2d_spp2_I_with_C_C_C_fgUINT16(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgUINT16);
}

int testreplace2d_spp2_I_with_C_C_C_fgUINT32(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgUINT32);
}

int testreplace2d_spp2_I_with_C_C_C_fgINT8(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgINT8);
}

int testreplace2d_spp2_I_with_C_C_C_fgINT16(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgINT16);
}

int testreplace2d_spp2_I_with_C_C_C_fgINT32(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgINT32);
}

int testreplace2d_spp2_I_with_C_C_C_fgFLOAT32(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgFLOAT32);
}

int testreplace2d_spp2_I_with_C_C_C_fgFLOAT64(void) {
  tstReplace2d_spp2_I_with_C_C_C(fgFLOAT64);
}







